<?php

class WhatsNewSidebarPanel extends DefaultSidebarPanel
{
    public function GetGeneratedContent( $panelInfo, TemplateEngine $tmpl, $pageId )
    {
        $content = '';
        $hash = Core::GetProperty("last_news_hash");

        $cacheId = "html/_sidebar_panels/". $panelInfo['id'] . "_$hash";
        
        $news = Core::ResourceManager()->GetBlogNews();
        $tmplVars = null;
        if ( !empty($news) )
        {
            $news = $news[0];
            $tmplVars = array('TITLE' => $news->title, 'LINK' => $news->link);
        }
        
        return $this->GenerateContent($cacheId, $panelInfo, $tmpl, $tmplVars);
    }
}

?>
